Skip to content

feat(models): complete 1:1 OpenAI API surface + unified router#46

Merged
AdaWorldAPI merged 1 commit into
masterfrom
claude/transcode-deepnsm-rust-oNa1Z
Mar 29, 2026
Merged

feat(models): complete 1:1 OpenAI API surface + unified router#46
AdaWorldAPI merged 1 commit into
masterfrom
claude/transcode-deepnsm-rust-oNa1Z

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Rewrite api_types.rs as single source of truth with exact OpenAI field
names and object types:

  • CompletionRequest/Response with logprobs, stop, penalties, seed
  • ChatCompletionRequest/Response with tools, streaming chunks, deltas
  • EmbeddingRequest/Response with encoding_format, dimensions
  • ImageGenerationRequest/Response with size parsing, quality, style
  • Model/ModelList with object fields ("model", "list")
  • ErrorResponse envelope matching OpenAI error format
  • ChatRole with as_str()/from_str() for wire format

Add router.rs — unified ModelRouter dispatching by model ID:

  • complete() → GPT-2
  • chat_complete() → OpenChat 3.5 (or GPT-2 via chat↔completion adapter)
  • embed() → GPT-2 wte (extensible to Jina/BERT)
  • list_models() / get_model() → all registered models
  • chat↔completion adapters for cross-model compatibility

Rewire gpt2/api.rs, openchat/api.rs, stable_diffusion/api.rs to use
shared types. No JSON/serde surface — pure Rust types for in-binary
consumers (q2, lance-graph).

58 API tests passing.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7

Rewrite api_types.rs as single source of truth with exact OpenAI field
names and object types:
- CompletionRequest/Response with logprobs, stop, penalties, seed
- ChatCompletionRequest/Response with tools, streaming chunks, deltas
- EmbeddingRequest/Response with encoding_format, dimensions
- ImageGenerationRequest/Response with size parsing, quality, style
- Model/ModelList with object fields ("model", "list")
- ErrorResponse envelope matching OpenAI error format
- ChatRole with as_str()/from_str() for wire format

Add router.rs — unified ModelRouter dispatching by model ID:
- complete() → GPT-2
- chat_complete() → OpenChat 3.5 (or GPT-2 via chat↔completion adapter)
- embed() → GPT-2 wte (extensible to Jina/BERT)
- list_models() / get_model() → all registered models
- chat↔completion adapters for cross-model compatibility

Rewire gpt2/api.rs, openchat/api.rs, stable_diffusion/api.rs to use
shared types. No JSON/serde surface — pure Rust types for in-binary
consumers (q2, lance-graph).

58 API tests passing.

https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
@AdaWorldAPI AdaWorldAPI merged commit 0f603bf into master Mar 29, 2026
4 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants